import upload from '@/utils/upload'
import request from '@/utils/request'

// ai任务列表
export function taskList(data) {
  return request({
    url: '/ai/assistant/task_list',
    method: 'get',
    data: data
  })
}

// ai任务编辑
export function taskEdit(data) {
  return request({
    url: '/ai/assistant/task',
    method: 'post',
    data: data
  })
}

// ai任务详情
export function taskDetail(id) {
  return request({
    url: '/ai/assistant/task/'+id,
    method: 'get'
  })
}

// ai任务删除
export function taskDel(id) {
  return request({
    url: '/ai/assistant/task/'+id,
    method: 'delete'
  })
}


// ai todo列表
export function todoList(data) {
  return request({
    url: '/ai/assistant/todo_list',
    method: 'get',
    data: data
  })
}

// ai todo新增
export function todoAdd(data) {
  return request({
    url: '/ai/assistant/todo/add',
    method: 'post',
    data: data
  })
}

// ai todo编辑
export function todoEdit(data) {
  return request({
    url: '/ai/assistant/todo/edit',
    method: 'post',
    data: data
  })
}

// ai todo详情
export function todoDetail(id) {
  return request({
    url: '/ai/assistant/todo/'+id,
    method: 'get'
  })
}

// ai todo删除
export function todoDel(id) {
  return request({
    url: '/ai/assistant/todo/delete/'+id,
    method: 'delete'
  })
}

// ai quest列表
export function questList(data) {
  return request({
    url: '/ai/assistant/quest/list',
    method: 'get',
    data: data
  })
}


// ai任务--发到企业微信
export function taskAddQYWXSchedule(data) {
  return request({
    url: '/ai/assistant/task/addQYWXSchedule',
    method: 'post',
    data: data
  })
}

// ai语言大模型-任务分析
export function taskAnalysis(data) {
  return request({
    url: '/ai/assistant/task_analysis',
    method: 'post',
    data: data
  })
}

// ai语言大模型
export function chat(data) {
  return request({
    url: '/ai/assistant/chat',
    method: 'post',
    data: data
  })
}

// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params: data
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}



// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/system/user/profile/avatar',
    name: data.name,
    filePath: data.filePath
  })
}
